<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>


        <ui:composition template="./../../Template/generalTemplate.xhtml">
            <ui:define name="content">
                <h:form id="form" prependId="false">
                    <p:dataTable var="records"  widgetVar="carsTable" value="#{viewProductBatchRecordsManagedBean.getProductRecords()}" emptyMessage="No records found with given criteria">  

                        <f:facet name="header">  
                            <p:outputPanel>  
                                <h:outputText value="Search all fields:" />  
                                <p:inputText id="globalFilter" onkeyup="carsTable.filter()" style="width:150px" />  
                            </p:outputPanel>  
                        </f:facet>  

                        <p:column filterBy="#{records.id}"   
                                  headerText="Batch id" footerText="contains"  
                                  filterMatchMode="contains">  
                            <h:outputText value="#{records.id}" />  
                        </p:column>  

                        <p:column filterBy="#{records.productInventoryLevel.product.productName}"  
                                  headerText="Product Name" footerText="endsWith"  filterMatchMode="endsWith">  
                            <h:outputText value="#{records.productInventoryLevel.product.productName}" />  
                        </p:column>  

                        <p:column  filterBy="#{records.manufactureDate}"   
                                  headerText="Manufacturer Date" footerText="contains"  
                                  
                                  filterMatchMode="contains">  
                           
                            <h:outputText value="#{records.manufactureDate}" >
                          <f:convertDateTime pattern="yyyy.MMMMM.dd"/>
                            </h:outputText>
                        </p:column>  

                        <p:column filterBy="#{records.quantity}"  
                                  headerText="Quantity" footerText="startsWith" filterMatchMode="startsWith">  
                            <h:outputText value="#{records.quantity}" />  
                        </p:column>  
                        
                          <p:column filterBy="#{records.productInventoryLevel.product.warehouseLocation}"  
                                  headerText="Warehouse Location" footerText="endsWith" filterMatchMode="endsWith">  
                            <h:outputText value="#{records.productInventoryLevel.product.warehouseLocation}" />  
                        </p:column>  
                        
                          <p:column filterBy="#{records.reserved}"  
                                  headerText="Reserved or not" footerText="exact" filterMatchMode="exact">  
                            <h:outputText value="#{records.reserved}" />  
                            
                        </p:column>  
                        <p:column filterBy="#{records.salesOrder.id}"  
                                  headerText="Attached Sales Order Id" footerText="exact" filterMatchMode="exact">  
                            <h:outputText value="#{records.salesOrder.id}" />  
                            
                        </p:column>  
                    </p:dataTable>  

                </h:form>
            </ui:define>
        </ui:composition>



    </body>
</html>
